]> dgit.raspbian.org Git - gnome-shell.git/commit
screenshot: Ensure that ShellScreenshot stays alive until the callback
authorJasper St. Pierre <jstpierre@mecheye.net>
Sun, 25 Mar 2012 14:54:08 +0000 (11:54 -0300)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 26 Mar 2012 15:54:07 +0000 (12:54 -0300)
commit2b87bb015cd057ea44f8d9767386f6437848ed71
treeb6136533f8ca6faed6aa0f6796d6b47fea11aa6a
parent07e10fa03e01ae2f491743b1ba54b10ce4f5503e
screenshot: Ensure that ShellScreenshot stays alive until the callback

We've been dangling on the edge of unsafety, unnoticed, for a little while
about the reference count safety of ShellScreenshot. GJS owns the entire
reference count, so as soon as it goes out of scope it could die, causing
GJS to try and fetch the corresponding wrapper object for a stale pointer.
We haven't seen any crashes because of luck -- SpiderMonkey tries to group
together deallocations to limit GC pauses, and there isn't really a lot
of GC pressure in the duration that a screenshot happens, so we tend to
be mostly stable. But in the case that you create a lot of objects while
a screenshot is going on, by hammering the "Print Screen" button, for
example, you can destroy the GObject before the callback finishes.

https://bugzilla.gnome.org/show_bug.cgi?id=672775
src/shell-screenshot.c